﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
namespace WebApplication.Admins.Controls
{
    public partial class UCKhachHang : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                Display();
            }

        }
        public void Display()
        {

            dlTinhThanh.DataValueField = "IDTinhTP";
            dlTinhThanh.DataTextField = "TenTinhTP";
            dlTinhThanh.DataSource = BLL.Tinh_ThanhPhoBLL.LayTatCa();
            dlTinhThanh.DataBind();

            string cid = Request.QueryString["Id"] ?? "";
            if (cid != "")
            {

                Entities.KhachHang data = KhachHangBLL.LayID(cid);
                if (data == null)
                    Response.Redirect("~/Admin/TinTuc.aspx");
                lblTitle.Text = "Quản Lý Tin Tức";
                lblId.Text = data.IDKhachHang.ToString();
                txtHo.Text = data.HoKH;
                txtTen.Text = data.TenKH;
                txtCMND.Text = data.SCMND;
               txtDiaChi.Text=data.DiaChi;
               dlTinhThanh.SelectedValue = data.IDTinhTP.ToString();
               
            }
        }
    }
}